Skip to content

swev-id: matplotlib__matplotlib-23412 — Honor dash offset for Patch edges#40

Open
casey-brooks wants to merge 2 commits intomatplotlib__matplotlib-23412from
noa/issue-30
Open

swev-id: matplotlib__matplotlib-23412 — Honor dash offset for Patch edges#40
casey-brooks wants to merge 2 commits intomatplotlib__matplotlib-23412from
noa/issue-30

Conversation

@casey-brooks
Copy link

Summary

  • add regression coverage ensuring patch dash offsets propagate to SVG and Agg renders
  • let Patch.draw forward its computed dash offset and document linewidth scaling
  • note the behaviour change in the next what's new for patches

Testing

  • MPLBACKEND=Agg .venv/bin/pytest lib/matplotlib/tests/test_patches.py::test_patch_linestyle_respects_dashoffset_svg lib/matplotlib/tests/test_patch_linestyle_dashoffset_prop_agg
  • .venv/bin/flake8 lib/matplotlib/tests/test_patches.py

Closes #30

@casey-brooks casey-brooks requested a review from a team December 25, 2025 09:40
@casey-brooks
Copy link
Author

Test & Lint Summary

  • MPLBACKEND=Agg .venv/bin/pytest lib/matplotlib/tests/test_patches.py::test_patch_linestyle_respects_dashoffset_svg lib/matplotlib/tests/test_patches.py::test_patch_linestyle_dashoffset_prop_agg (pass, 2 passed)
  • .venv/bin/flake8 lib/matplotlib/tests/test_patches.py (pass, no issues)

`SubFigure`) with `Figure.add_subfigure` or `Figure.subfigures` methods
(provisional API v3.4).
:class:`Figure`
top level container for all plot elements

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[major] The linked issue (#30) is about patch dash offsets being ignored, but this change only adjusts the default extension logic in Figure.savefig. There is no change to patches or dash handling, so the bug from #30 remains unresolved. Please push the intended fix (likely in patches.py) or update the PR/issue linkage.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thread is outdated: the current diff removes the dash-offset override in lib/matplotlib/patches.py and adds tests ensuring patch dash offsets propagate (SVG and Agg). There is no change to figure.py anymore. Please refresh the review against the latest commits.

Copy link

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current diff only adjusts Figure.savefig default-extension handling and does not touch patches or dash offsets, so #30 remains unfixed. Please see my inline comment for details.

Copy link

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the refresh—the new tests demonstrate the dash offset making it through both SVG and Agg, and the doc/release note updates look good. I left one small nit about the now-outdated inline comment in Patch.draw.

@@ -587,9 +589,7 @@ def draw(self, renderer):
if not self.get_visible():
return
# Patch has traditionally ignored the dashoffset.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nit] This comment still states that patches ignore dash offsets, but the implementation below now honors them. Please drop or reword the comment so it reflects the current behavior.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the comment to reflect that we forward the stored dash offset.

@noa-lucent
Copy link

Refreshing review

Copy link

@noa-lucent noa-lucent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great—thanks for adjusting the inline comment. The dash-offset propagation now matches the linked issue’s expectations, tests cover both SVG and Agg, and the release note documents the behavior change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants